<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<h2 matDialogTitle>API Review</h2>
<ng-container *ngIf="!isLoading; else loader">
  <mat-dialog-content class="content">
    <div *ngIf="qualityRules.length" class="mat-body-strong">Quality rules</div>
    <gio-form-slide-toggle *ngFor="let qualityRule of qualityRules">
      <gio-form-label>{{ qualityRule.name }}</gio-form-label>
      {{ qualityRule.description }}
      <mat-slide-toggle gioFormSlideToggle [name]="qualityRule.name" [(ngModel)]="qualityRule.checked"></mat-slide-toggle>
    </gio-form-slide-toggle>
    <mat-form-field appearance="outline" class="content__comments">
      <mat-label>Review comments</mat-label>
      <textarea #input matInput aria-label="Review comments" [formControl]="reviewComments" maxlength="500" rows="2"></textarea>
      <mat-hint align="end">{{ input.value.length }}/500</mat-hint>
    </mat-form-field>
  </mat-dialog-content>
  <mat-dialog-actions class="actions" align="end">
    <button mat-flat-button [mat-dialog-close]="undefined">Cancel</button>
    <button color="primary" mat-raised-button aria-label="Accept the review" (click)="onConfirm(true)">Accept</button>
    <button color="warn" mat-raised-button aria-label="Reject the review" (click)="onConfirm(false)">Reject</button>
  </mat-dialog-actions>
</ng-container>

<ng-template #loader>
  <mat-dialog-content class="content">
    <gio-loader></gio-loader>
  </mat-dialog-content>
</ng-template>
